package io.github.rascaler.dcenter.platforms;

import io.github.rascaler.dcenter.constant.ExceptionCode;
import io.github.rascaler.dcenter.exception.BizException;

public class Frequency {

    public static int getFrequencyUnit(String frequency) {
        switch (frequency) {
            case "1min":
                return  60 * 1000;
            case "3min":
                return  3 * 60 * 1000;
            case "5min":
                return 5 * 60 * 1000;
            case "15min":
                return 15 * 60 * 1000;
            case "30min":
                return 30 * 60 * 1000;
            case "1hour":
                return 60 * 60 * 1000;
            case "2hour":
                return 2 * 60 * 60 * 1000;
            case "4hour":
                return 4 * 60 * 60 * 1000;
            case "8hour":
                return 8 * 60 * 60 * 1000;
            case "12hour":
                return 12 * 60 * 60 * 1000;
            default:
                throw new BizException(ExceptionCode.ILLEGAL_FREQUENCY);
        }
    }
}
